-
Notifications
You must be signed in to change notification settings - Fork 560
add cuopt direct solver #3620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
add cuopt direct solver #3620
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3620 +/- ##
==========================================
- Coverage 89.24% 86.01% -3.23%
==========================================
Files 907 908 +1
Lines 104866 105112 +246
==========================================
- Hits 93585 90412 -3173
- Misses 11281 14700 +3419
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are working on making cuopt available in our testing infrastructure; can you please add tests to this PR?
|
@Iroy30 - We've been able to make cuopt available on our internal testing machines. Can you please add tests to this PR? |
5dbf9dd to
6f64094
Compare
|
@mrmundt Thanks! We have added tests by enabling testing cuopt with LP and MILP capabilities in tests/solvers.py. Let us know if:
The following is the testing output I get relevant to cuOpt |
| t0 = time.time() | ||
| self.solution = cuopt.linear_programming.solver.Solve(self._solver_model) | ||
| t1 = time.time() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, but just so you're aware, we have this lovely little utility called TicTocTimer that you may want to consider using: https://pyomo.readthedocs.io/en/latest/api/pyomo.common.timing.TicTocTimer.html
|
@mrmundt What do you think about including this solver interface in pyomo.contrib.solvers? Would it make sense to pull-in new solver interfaces there, since that's where the new solver API is evolving? |
@whart222 - I am evenly split. Because we are still messing with what the new solver interfaces are going to actually do / how they will handle input and present output, I don't know if we want to put "new" solvers there or just "well-established" ones that we can robustly test / really know what they are supposed to do and return. |
|
@Iroy30 - I forgot to post this last week, but all of the failures are of the variety: |
|
@Iroy30 - Two more things:
|
Co-authored-by: Miranda Mundt <[email protected]>
|
@jsiirola The segfaults you see in CI with 25.08 is concerning. Was the CI running the 25.08 release or the daily build of cuopt(this could cause the segfault). If 25.08 release was causing segfault then we might have to enforce minimum cuopt 25.10 and meanwhile I will debug 25.08 on my end because we were not seeing this previously |
The CI is running cuopt-cu12/25.8.0 from PyPI. I have added 25.10.0 (also from PyPI), but that won't make it to the build machines for testing until later tonight (it is waiting on finalizing the Pyomo 6.9.5 release) |
|
We attempted to upgrade |
|
It could be because it pulls some old artifacts and gives a blanket error. Could you try the following: |
|
Hi @bbozkaya - It would be best if you attended one of our weekly dev calls which happen every Tuesday at 12:30PM MT. Please email [email protected] and we can send you the connections details. |
|
@jsiirola Did the instructions fix the cuOpt import? |
| def __init__(self, **kwds): | ||
| kwds["type"] = "cuoptdirect" | ||
| super(CUOPTDirect, self).__init__(**kwds) | ||
| self._version = cuopt.__version__.split('.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the problem line. If cuopt isn't actually available, then this panics. You should probably wrap this in a try block or move it into its own function, e.g.:
try:
self._version = cuopt.__version__.split('.')
except DeferredImportError:
self._version = None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, upon chatting in the dev call more about this just now, this should probably just be moved into its own function, not at all in the init, because if it's in the init, it will import cuopt unconditionally no matter what.
Fixes #3626
Summary/Motivation:
Add cuOpt math optimization (includes LP and MILP) solver backend to Pyomo so users can solve pyomo models with cuOpt
Changes proposed in this PR:
Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: